<template>
  <div class="home">
    <top-view></top-view>
    <sales-view></sales-view>
    <bottom-view></bottom-view>
    <map-view></map-view>
  </div>
</template>

<script>
// @ is an alias to /src
// import HelloWorld from '@/components/HelloWorld.vue'
import TopView from "@/components/TopView";
import MapView from "@/components/MapView";
import SalesView from "@/components/SalesView";
import BottomView from "@/components/BottomView";

import { wordcloud,scatter,data} from "@/api";
export default {
  name: "Home",
  components: {
    TopView,
    MapView,
    SalesView,
    BottomView,
  },
  data(){
    return {
      reportData: null,
      wordCloud: null,
      mapData: null
    }
  },
  methods: {
    getReportData(){
      return this.reportData
    },
    getWordCloud(){
      return this.wordCloud
    },
    getMapData(){
      return this.mapData
    },
  },
  provide(){
    return {
      getReportData: this.getReportData,
      getWordCloud: this.getWordCloud,
      getMapData: this.getMapData
    }
  },
  mounted() {
    wordcloud().then(data=>{this.wordCloud = data})
    scatter().then(data=>{this.mapData = data})
    data().then(data=>{this.reportData = data})
    // test2();
    // test2().catch((err) => alert(err.message)); //返回错误信息
  },
};
</script>
<style lang="scss" scoped>
.home {
  width: 100%;
  // height: 100%;
  padding: 20px;
  background: #eee;
  box-sizing: border-box;
}
</style>
